package com.igeek.oa.controller;

import cn.hutool.core.util.ObjectUtil;
import com.igeek.oa.entity.Address;
import com.igeek.oa.entity.Officesupplies;
import com.igeek.oa.result.Result;
import com.igeek.oa.service.IAddressService;
import io.swagger.annotations.Api;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/adress")
@Api("公司信息查询")
public class AdressController {
    @Autowired
    private IAddressService iAddressService;
    @GetMapping("/getAdress")
    public Result getAdress() {
        try {
            List<Address> addressList =iAddressService.getAdress();
            if(ObjectUtil.isNotEmpty(addressList)){
                return new Result(true,"查询成功",addressList);
            }
        } catch (Exception e) {
            throw new RuntimeException(e);
        }
        return new Result(true,"查询失败",null);
    }
}
